package cn.lxh.yatzy;

import java.util.Arrays;
import java.util.List;

/**
 * @ClassName CountScore
 * @Description 计算骰子和
 * @Author luoxiaohu
 * @Date 2023/11/1 9:59
 * @Vsersion 1.0
 **/
public class CountScore {
    private int sum = 0;
    public Integer Sum(int[] a) {
        sum = Arrays.stream(a).sum();
        return sum;
    }

    public Integer FullHouse(int[] a) {
       return Sum(a) + 50;
    }

    public Integer Pairs(int[] a, List<Integer> list) {
        sum = Sum(a) + list.get(0) * 2;
        return sum;
    }

    public Integer TwoPair(int[] a, List<Integer> list) {
       return Sum(a) + list.get(0) * 2 + list.get(1) * 2;
    }

    public Integer ThreeOfAKind(int[] a, List<Integer> list) {
        return  Sum(a) + list.get(0) * 3;
    }

    public Integer FourOfAKind(int[] a, List<Integer> list) {
       return Sum(a) + list.get(0) * 4;
    }


    public Integer smallStraight(int[] a) {
       return Sum(a) + 15;
    }
    public Integer LargeStraight(int[] a) {
        return Sum(a) + 20;
    }

    public Integer ThreeOfAKindAndPairs(int[] a) {
        return  Sum(a) * 2;
    }
}
